/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "det_tarjetas", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetTarjetas.findAll", query = "SELECT d FROM DetTarjetas d"),
    @NamedQuery(name = "DetTarjetas.findByTarjFecha", query = "SELECT d FROM DetTarjetas d WHERE d.detTarjetasPK.tarjFecha = :tarjFecha"),
    @NamedQuery(name = "DetTarjetas.findByCobCod", query = "SELECT d FROM DetTarjetas d WHERE d.detTarjetasPK.cobCod = :cobCod"),
    @NamedQuery(name = "DetTarjetas.findByCobMonto", query = "SELECT d FROM DetTarjetas d WHERE d.cobMonto = :cobMonto"),
    @NamedQuery(name = "DetTarjetas.findByCobNroaut", query = "SELECT d FROM DetTarjetas d WHERE d.cobNroaut = :cobNroaut")})
public class DetTarjetas implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetTarjetasPK detTarjetasPK;
    @Column(name = "cob_monto")
    private Integer cobMonto;
    @Column(name = "cob_nroaut")
    private Integer cobNroaut;
    @JoinColumn(name = "entidad_adherida_idMarcas", referencedColumnName = "idMarcas", nullable = false)
    @ManyToOne(optional = false)
    private EntidadAdherida entidadadheridaidMarcas;
    @JoinColumn(name = "tarj_fecha", referencedColumnName = "tarj_fecha", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tarjeta tarjeta;
    @JoinColumn(name = "cob_cod", referencedColumnName = "cob_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Cobro cobro;

    public DetTarjetas() {
    }

    public DetTarjetas(DetTarjetasPK detTarjetasPK) {
        this.detTarjetasPK = detTarjetasPK;
    }

    public DetTarjetas(int tarjFecha, int cobCod) {
        this.detTarjetasPK = new DetTarjetasPK(tarjFecha, cobCod);
    }

    public DetTarjetasPK getDetTarjetasPK() {
        return detTarjetasPK;
    }

    public void setDetTarjetasPK(DetTarjetasPK detTarjetasPK) {
        this.detTarjetasPK = detTarjetasPK;
    }

    public Integer getCobMonto() {
        return cobMonto;
    }

    public void setCobMonto(Integer cobMonto) {
        this.cobMonto = cobMonto;
    }

    public Integer getCobNroaut() {
        return cobNroaut;
    }

    public void setCobNroaut(Integer cobNroaut) {
        this.cobNroaut = cobNroaut;
    }

    public EntidadAdherida getEntidadadheridaidMarcas() {
        return entidadadheridaidMarcas;
    }

    public void setEntidadadheridaidMarcas(EntidadAdherida entidadadheridaidMarcas) {
        this.entidadadheridaidMarcas = entidadadheridaidMarcas;
    }

    public Tarjeta getTarjeta() {
        return tarjeta;
    }

    public void setTarjeta(Tarjeta tarjeta) {
        this.tarjeta = tarjeta;
    }

    public Cobro getCobro() {
        return cobro;
    }

    public void setCobro(Cobro cobro) {
        this.cobro = cobro;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detTarjetasPK != null ? detTarjetasPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetTarjetas)) {
            return false;
        }
        DetTarjetas other = (DetTarjetas) object;
        if ((this.detTarjetasPK == null && other.detTarjetasPK != null) || (this.detTarjetasPK != null && !this.detTarjetasPK.equals(other.detTarjetasPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.DetTarjetas[ detTarjetasPK=" + detTarjetasPK + " ]";
    }
    
}
